<style>
    #expert-add {
        padding: 20px 25px 25px 0;
    }

    .layui-layer-page .layui-layer-content {
        overflow: visible !important;
    }
</style>
<div class="layui-fluid" id="expert-add">
    <form class="layui-form" action="">
        <div class="layui-form-item ">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">专家姓名：</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" minlength="2" maxlength="10" lay-verify="required"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">学科分类：</label>
                    <div class="layui-input-block">
                        <select name="subjectTypeCode" lay-verify="required">
                            <option value="">请选择</option>
                            <option
                                    th:each="item : ${subjectTypeList}"
                                    th:value="${item.code}" th:text="${item.name}">
                            </option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">所属单位：</label>
                    <div class="layui-input-block">
                        <input type="text" name="company" lay-verify="required" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-md6">
                    <label class="layui-form-label">固定电话：</label>
                    <div class="layui-input-block">
                        <input type="tel" name="phone" lay-verify="tellphone" maxlength="50" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">证件类型：</label>
                    <div class="layui-input-block">
                        <select name="identityTypeCode" lay-filter="identityTypeCode" lay-verify="required" id="identityTypeCode">
                            <option value="">请选择</option>
                            <option
                                    th:each="item : ${zjlxList}"
                                    th:value="${item.code}" th:text="${item.name}">
                            </option>
                        </select>
                    </div>
                </div>
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">证件号：</label>
                    <div class="layui-input-block">
                        <input id="identityId" type="text" name="identityId" lay-verify="required" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <label class="layui-form-label">银行帐号开户行：</label>
                    <div class="layui-input-block">
                        <input type="text" name="bankName" maxlength="80" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-md6">
                    <label class="layui-form-label">银行帐号：</label>
                    <div class="layui-input-block">
                        <input type="text" name="accountId" lay-verify="bank" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">理论与实务专家：</label>
                    <div class="layui-input-block">
                        <select name="featureTypeCode" lay-verify="required">
                            <option value="">请选择</option>
                            <option
                                    th:each="item : ${featureList}"
                                    th:value="${item.code}" th:text="${item.name}">
                            </option>
                        </select>
                    </div>
                </div>
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">京内与京外专家：</label>
                    <div class="layui-input-block">
                        <select name="districtTypeCode" lay-verify="required">
                            <option value="">请选择</option>
                            <option
                                    th:each="item : ${districtList}"
                                    th:value="${item.code}" th:text="${item.name}">
                            </option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">邮箱：</label>
                    <div class="layui-input-block">
                        <input type="text" name="email" lay-verify="required|email" maxlength="50" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">移动手机：</label>
                    <div class="layui-input-block">
                        <input type="text" name="mobile" lay-verify="required|phone" maxlength="50" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-md6">
                <label class="layui-form-label">通讯地址：</label>
                <div class="layui-input-block">
                    <input type="text" name="address" maxlength="100" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-md6">
                <label class="layui-form-label website-form-item-require">学术委员会成员：</label>
                <div class="layui-input-block">
                    <select name="isMember" lay-verify="required">
                        <option value="">请选择</option>
                        <option value="0"> 否</option>
                        <option value="1"> 是</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-md6">
                <label class="layui-form-label website-form-item-require">职称：</label>
                <div class="layui-input-block">
                    <input type="text" name="titleTypeCode" lay-verify="required" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item website-hide">
            <button class="layui-btn" lay-submit="" lay-filter="expert-add-form-submit" id="submit"></button>
            <button type="reset" class="layui-btn" id="reset"></button>
        </div>
    </form>
</div>

<script>
    layui.use(['website', 'form', 'validate', 'eleTree'], function () {
        var $ = layui.$,
            website = layui.website,
            layer = layui.layer,
            form = layui.form,
            $view = $('#expert-add'),
            validate = layui.validate;
        form.verify(validate);
        form.render();
        form.on('select(identityTypeCode)', function (data) {
            if ("zjlx_sfz" === data.value) {
                $('#identityId')[0].setAttribute('lay-verify', "required|identityNumber")
            }else {
                $('#identityId')[0].setAttribute('lay-verify', "required")
            }
        });
        form.on('submit(expert-add-form-submit)', function (data) {
            website.post(ctx + 'expert', data.field, function () {
                layer.closeAll();
                website.alert.success('新增专家成功');
                $('#website-expert').find('#query').click();
            });
            return false;
        });
    });
</script>